package com.relax.feture;

import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

public class Feturedemo {

    public static void main(String[] args) throws ExecutionException, InterruptedException {
        Callable<Integer> callable = new Callable<Integer>() {
            public Integer call() throws Exception {
                System.out.println("线程开始执行");
                return 11;
            }
        };


        FutureTask<Integer> task = new FutureTask<Integer>(callable);

        new Thread(task).start();

        System.out.println("feture-task.get()-执行前");
        System.out.println(task.get());
        System.out.println("feture-task.get()-执行后");

    }

}
